// To parse this JSON data, do
//
//     final media = mediaFromJson(jsonString);

import 'dart:convert';

class Media {
  Media({
    this.name,
    this.originalTitle,
    this.serverId,
    this.id,
    this.etag,
    this.dateCreated,
    this.canDelete,
    this.canDownload,
    this.presentationUniqueKey,
    this.supportsSync,
    this.container,
    this.sortName,
    this.premiereDate,
    this.externalUrls,
    this.mediaSources,
    this.productionLocations,
    this.path,
    this.officialRating,
    this.overview,
    this.taglines,
    this.genres,
    this.communityRating,
    this.runTimeTicks,
    this.playAccess,
    this.productionYear,
    this.remoteTrailers,
    this.providerIds,
    this.isFolder,
    this.parentId,
    this.type,
    this.people,
    this.studios,
    this.genreItems,
    this.tagItems,
    this.localTrailerCount,
    this.userData,
    this.displayPreferencesId,
    this.tags,
    this.primaryImageAspectRatio,
    this.mediaStreams,
    this.imageTags,
    this.backdropImageTags,
    this.chapters,
    this.mediaType,
    this.lockedFields,
    this.lockData,
    this.width,
    this.height,
  });

  String name;
  String originalTitle;
  String serverId;
  String id;
  String etag;
  DateTime dateCreated;
  bool canDelete;
  bool canDownload;
  String presentationUniqueKey;
  bool supportsSync;
  String container;
  String sortName;
  DateTime premiereDate;
  List<ExternalUrl> externalUrls;
  List<MediaSource> mediaSources;
  List<String> productionLocations;
  String path;
  String officialRating;
  String overview;
  List<dynamic> taglines;
  List<String> genres;
  double communityRating;
  int runTimeTicks;
  String playAccess;
  int productionYear;
  List<ExternalUrl> remoteTrailers;
  ProviderIds providerIds;
  bool isFolder;
  String parentId;
  String type;
  List<Person> people;
  List<GenreItem> studios;
  List<GenreItem> genreItems = [];
  List<dynamic> tagItems;
  int localTrailerCount;
  UserData userData;
  String displayPreferencesId;
  List<dynamic> tags;
  double primaryImageAspectRatio;
  List<MediaStream> mediaStreams;
  ImageTags imageTags;
  List<String> backdropImageTags;
  List<Chapter> chapters;
  Type mediaType;
  List<dynamic> lockedFields;
  bool lockData;
  int width;
  int height;

  factory Media.fromRawJson(String str) => Media.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Media.fromJson(Map<String, dynamic> json) => Media(
        name: json["Name"],
        originalTitle: json["OriginalTitle"],
        serverId: json["ServerId"],
        id: json["Id"],
        etag: json["Etag"],
        dateCreated: json["DateCreated"] != null ? DateTime.parse(json["DateCreated"]) : null,
        canDelete: json["CanDelete"] ?? false,
        canDownload: json["CanDownload"] ?? false,
        presentationUniqueKey: json["PresentationUniqueKey"],
        supportsSync: json["SupportsSync"],
        container: json["Container"],
        sortName: json["SortName"],
        premiereDate: json["PremiereDate"] != null ? DateTime.parse(json["PremiereDate"]) : null,
        externalUrls: json["ExternalUrls"] != null ? List<ExternalUrl>.from(json["ExternalUrls"].map((x) => ExternalUrl.fromJson(x))) : [],
        mediaSources: json["MediaSources"] != null ? List<MediaSource>.from(json["MediaSources"].map((x) => MediaSource.fromJson(x))) : [],
        productionLocations: json["ProductionLocations"] != null ? List<String>.from(json["ProductionLocations"].map((x) => x)) : [],
        path: json["Path"],
        officialRating: json["OfficialRating"],
        overview: json["Overview"],
        taglines: json["Taglines"] != null ? List<dynamic>.from(json["Taglines"].map((x) => x)) : [],
        genres: json["Genres"] != null ? List<String>.from(json["Genres"].map((x) => x)) : [],
        communityRating: json["CommunityRating"] != null ? json["CommunityRating"].toDouble() : 0,
        runTimeTicks: json["RunTimeTicks"],
        playAccess: json["PlayAccess"],
        productionYear: json["ProductionYear"],
        remoteTrailers: json["RemoteTrailers"] != null ? List<ExternalUrl>.from(json["RemoteTrailers"].map((x) => ExternalUrl.fromJson(x))) : [],
        providerIds: json["ProviderIds"] != null ? ProviderIds.fromJson(json["ProviderIds"]) : null,
        isFolder: json["IsFolder"],
        parentId: json["ParentId"],
        type: json["Type"],
        people: json["People"] != null ? List<Person>.from(json["People"].map((x) => Person.fromJson(x))) : [],
        studios: json["Studios"] != null ? List<GenreItem>.from(json["Studios"].map((x) => GenreItem.fromJson(x))) : [],
        genreItems: json["GenreItems"] != null ? List<GenreItem>.from(json["GenreItems"].map((x) => GenreItem.fromJson(x))) : [],
        tagItems: json["TagItems"] != null ? List<dynamic>.from(json["TagItems"].map((x) => x)) : [],
        localTrailerCount: json["LocalTrailerCount"],
        userData: json["UserData"] != null ? UserData.fromJson(json["UserData"]) : null,
        displayPreferencesId: json["DisplayPreferencesId"],
        tags: json["Tags"] != null ? List<dynamic>.from(json["Tags"].map((x) => x)) : [],
        primaryImageAspectRatio: json["PrimaryImageAspectRatio"].toDouble(),
        mediaStreams: json["MediaStreams"] != null ? List<MediaStream>.from(json["MediaStreams"].map((x) => MediaStream.fromJson(x))) : [],
        imageTags: json["ImageTags"] != null ? ImageTags.fromJson(json["ImageTags"]) : [],
        backdropImageTags: json["BackdropImageTags"] != null ? List<String>.from(json["BackdropImageTags"].map((x) => x)) : [],
        chapters: json["Chapters"] != null ? List<Chapter>.from(json["Chapters"].map((x) => Chapter.fromJson(x))) : [],
        mediaType: typeValues.map[json["MediaType"]],
        lockedFields: json["LockedFields"] != null ? List<dynamic>.from(json["LockedFields"].map((x) => x)) : [],
        lockData: json["LockData"],
        width: json["Width"],
        height: json["Height"],
      );

  Map<String, dynamic> toJson() => {
        "Name": name,
        "OriginalTitle": originalTitle,
        "ServerId": serverId,
        "Id": id,
        "Etag": etag,
        "DateCreated": dateCreated.toIso8601String(),
        "CanDelete": canDelete,
        "CanDownload": canDownload,
        "PresentationUniqueKey": presentationUniqueKey,
        "SupportsSync": supportsSync,
        "Container": container,
        "SortName": sortName,
        "PremiereDate": premiereDate.toIso8601String(),
        "ExternalUrls": List<dynamic>.from(externalUrls.map((x) => x.toJson())),
        "MediaSources": List<dynamic>.from(mediaSources.map((x) => x.toJson())),
        "ProductionLocations": List<dynamic>.from(productionLocations.map((x) => x)),
        "Path": path,
        "OfficialRating": officialRating,
        "Overview": overview,
        "Taglines": List<dynamic>.from(taglines.map((x) => x)),
        "Genres": List<dynamic>.from(genres.map((x) => x)),
        "CommunityRating": communityRating,
        "RunTimeTicks": runTimeTicks,
        "PlayAccess": playAccess,
        "ProductionYear": productionYear,
        "RemoteTrailers": List<dynamic>.from(remoteTrailers.map((x) => x.toJson())),
        "ProviderIds": providerIds.toJson(),
        "IsFolder": isFolder,
        "ParentId": parentId,
        "Type": type,
        "People": List<dynamic>.from(people.map((x) => x.toJson())),
        "Studios": List<dynamic>.from(studios.map((x) => x.toJson())),
        "GenreItems": List<dynamic>.from(genreItems.map((x) => x.toJson())),
        "TagItems": List<dynamic>.from(tagItems.map((x) => x)),
        "LocalTrailerCount": localTrailerCount,
        "UserData": userData.toJson(),
        "DisplayPreferencesId": displayPreferencesId,
        "Tags": List<dynamic>.from(tags.map((x) => x)),
        "PrimaryImageAspectRatio": primaryImageAspectRatio,
        "MediaStreams": List<dynamic>.from(mediaStreams.map((x) => x.toJson())),
        "ImageTags": imageTags.toJson(),
        "BackdropImageTags": List<dynamic>.from(backdropImageTags.map((x) => x)),
        "Chapters": List<dynamic>.from(chapters.map((x) => x.toJson())),
        "MediaType": typeValues.reverse[mediaType],
        "LockedFields": List<dynamic>.from(lockedFields.map((x) => x)),
        "LockData": lockData,
        "Width": width,
        "Height": height,
      };
}

class Chapter {
  Chapter({
    this.startPositionTicks,
    this.name,
  });

  int startPositionTicks;
  String name;

  factory Chapter.fromRawJson(String str) => Chapter.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Chapter.fromJson(Map<String, dynamic> json) => Chapter(
        startPositionTicks: json["StartPositionTicks"],
        name: json["Name"],
      );

  Map<String, dynamic> toJson() => {
        "StartPositionTicks": startPositionTicks,
        "Name": name,
      };
}

class ExternalUrl {
  ExternalUrl({
    this.name,
    this.url,
  });

  String name;
  String url;

  factory ExternalUrl.fromRawJson(String str) => ExternalUrl.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory ExternalUrl.fromJson(Map<String, dynamic> json) => ExternalUrl(
        name: json["Name"],
        url: json["Url"],
      );

  Map<String, dynamic> toJson() => {
        "Name": name,
        "Url": url,
      };
}

class GenreItem {
  GenreItem({
    this.name,
    this.id,
  });

  String name;
  int id;

  factory GenreItem.fromRawJson(String str) => GenreItem.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory GenreItem.fromJson(Map<String, dynamic> json) => GenreItem(
        name: json["Name"],
        id: json["Id"],
      );

  Map<String, dynamic> toJson() => {
        "Name": name,
        "Id": id,
      };
}

class ImageTags {
  ImageTags({
    this.primary,
    this.logo,
    this.thumb,
  });

  String primary;
  String logo;
  String thumb;

  factory ImageTags.fromRawJson(String str) => ImageTags.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory ImageTags.fromJson(Map<String, dynamic> json) => ImageTags(
        primary: json["Primary"],
        logo: json["Logo"],
        thumb: json["Thumb"],
      );

  Map<String, dynamic> toJson() => {
        "Primary": primary,
        "Logo": logo,
        "Thumb": thumb,
      };
}

class MediaSource {
  MediaSource({
    this.protocol,
    this.id,
    this.path,
    this.type,
    this.container,
    this.size,
    this.name,
    this.isRemote,
    this.runTimeTicks,
    this.supportsTranscoding,
    this.supportsDirectStream,
    this.supportsDirectPlay,
    this.isInfiniteStream,
    this.requiresOpening,
    this.requiresClosing,
    this.requiresLooping,
    this.supportsProbing,
    this.mediaStreams,
    this.formats,
    this.bitrate,
    this.requiredHttpHeaders,
    this.readAtNativeFramerate,
    this.defaultAudioStreamIndex,
    this.defaultSubtitleStreamIndex,
  });

  Protocol protocol;
  String id;
  String path;
  String type;
  String container;
  int size;
  String name;
  bool isRemote;
  int runTimeTicks;
  bool supportsTranscoding;
  bool supportsDirectStream;
  bool supportsDirectPlay;
  bool isInfiniteStream;
  bool requiresOpening;
  bool requiresClosing;
  bool requiresLooping;
  bool supportsProbing;
  List<MediaStream> mediaStreams;
  List<dynamic> formats;
  int bitrate;
  RequiredHttpHeaders requiredHttpHeaders;
  bool readAtNativeFramerate;
  int defaultAudioStreamIndex;
  int defaultSubtitleStreamIndex;

  factory MediaSource.fromRawJson(String str) => MediaSource.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory MediaSource.fromJson(Map<String, dynamic> json) => MediaSource(
        protocol: protocolValues.map[json["Protocol"]],
        id: json["Id"],
        path: json["Path"],
        type: json["Type"],
        container: json["Container"],
        size: json["Size"],
        name: json["Name"],
        isRemote: json["IsRemote"],
        runTimeTicks: json["RunTimeTicks"],
        supportsTranscoding: json["SupportsTranscoding"],
        supportsDirectStream: json["SupportsDirectStream"],
        supportsDirectPlay: json["SupportsDirectPlay"],
        isInfiniteStream: json["IsInfiniteStream"],
        requiresOpening: json["RequiresOpening"],
        requiresClosing: json["RequiresClosing"],
        requiresLooping: json["RequiresLooping"],
        supportsProbing: json["SupportsProbing"],
        mediaStreams: List<MediaStream>.from(json["MediaStreams"].map((x) => MediaStream.fromJson(x))),
        formats: List<dynamic>.from(json["Formats"].map((x) => x)),
        bitrate: json["Bitrate"],
        requiredHttpHeaders: RequiredHttpHeaders.fromJson(json["RequiredHttpHeaders"]),
        readAtNativeFramerate: json["ReadAtNativeFramerate"],
        defaultAudioStreamIndex: json["DefaultAudioStreamIndex"],
        defaultSubtitleStreamIndex: json["DefaultSubtitleStreamIndex"],
      );

  Map<String, dynamic> toJson() => {
        "Protocol": protocolValues.reverse[protocol],
        "Id": id,
        "Path": path,
        "Type": type,
        "Container": container,
        "Size": size,
        "Name": name,
        "IsRemote": isRemote,
        "RunTimeTicks": runTimeTicks,
        "SupportsTranscoding": supportsTranscoding,
        "SupportsDirectStream": supportsDirectStream,
        "SupportsDirectPlay": supportsDirectPlay,
        "IsInfiniteStream": isInfiniteStream,
        "RequiresOpening": requiresOpening,
        "RequiresClosing": requiresClosing,
        "RequiresLooping": requiresLooping,
        "SupportsProbing": supportsProbing,
        "MediaStreams": List<dynamic>.from(mediaStreams.map((x) => x.toJson())),
        "Formats": List<dynamic>.from(formats.map((x) => x)),
        "Bitrate": bitrate,
        "RequiredHttpHeaders": requiredHttpHeaders.toJson(),
        "ReadAtNativeFramerate": readAtNativeFramerate,
        "DefaultAudioStreamIndex": defaultAudioStreamIndex,
        "DefaultSubtitleStreamIndex": defaultSubtitleStreamIndex,
      };
}

class MediaStream {
  MediaStream({
    this.codec,
    this.colorTransfer,
    this.colorPrimaries,
    this.colorSpace,
    this.timeBase,
    this.codecTimeBase,
    this.videoRange,
    this.displayTitle,
    this.nalLengthSize,
    this.isInterlaced,
    this.isAvc,
    this.bitRate,
    this.bitDepth,
    this.refFrames,
    this.isDefault,
    this.isForced,
    this.height,
    this.width,
    this.averageFrameRate,
    this.realFrameRate,
    this.profile,
    this.type,
    this.aspectRatio,
    this.index,
    this.isExternal,
    this.isTextSubtitleStream,
    this.supportsExternalStream,
    this.protocol,
    this.pixelFormat,
    this.level,
    this.isAnamorphic,
    this.language,
    this.displayLanguage,
    this.channels,
    this.sampleRate,
    this.title,
    this.path,
  });

  String codec;
  String colorTransfer;
  String colorPrimaries;
  String colorSpace;
  String timeBase;
  String codecTimeBase;
  String videoRange;
  String displayTitle;
  String nalLengthSize;
  bool isInterlaced;
  bool isAvc;
  int bitRate;
  int bitDepth;
  int refFrames;
  bool isDefault;
  bool isForced;
  int height;
  int width;
  double averageFrameRate;
  double realFrameRate;
  String profile;
  Type type;
  String aspectRatio;
  int index;
  bool isExternal;
  bool isTextSubtitleStream;
  bool supportsExternalStream;
  Protocol protocol;
  String pixelFormat;
  int level;
  bool isAnamorphic;
  String language;
  String displayLanguage;
  int channels;
  int sampleRate;
  String title;
  String path;

  factory MediaStream.fromRawJson(String str) => MediaStream.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory MediaStream.fromJson(Map<String, dynamic> json) => MediaStream(
        codec: json["Codec"],
        colorTransfer: json["ColorTransfer"] == null ? null : json["ColorTransfer"],
        colorPrimaries: json["ColorPrimaries"] == null ? null : json["ColorPrimaries"],
        colorSpace: json["ColorSpace"] == null ? null : json["ColorSpace"],
        timeBase: json["TimeBase"] == null ? null : json["TimeBase"],
        codecTimeBase: json["CodecTimeBase"] == null ? null : json["CodecTimeBase"],
        videoRange: json["VideoRange"] == null ? null : json["VideoRange"],
        displayTitle: json["DisplayTitle"],
        nalLengthSize: json["NalLengthSize"] == null ? null : json["NalLengthSize"],
        isInterlaced: json["IsInterlaced"],
        isAvc: json["IsAVC"] == null ? null : json["IsAVC"],
        bitRate: json["BitRate"] == null ? null : json["BitRate"],
        bitDepth: json["BitDepth"] == null ? null : json["BitDepth"],
        refFrames: json["RefFrames"] == null ? null : json["RefFrames"],
        isDefault: json["IsDefault"],
        isForced: json["IsForced"],
        height: json["Height"] == null ? null : json["Height"],
        width: json["Width"] == null ? null : json["Width"],
        averageFrameRate: json["AverageFrameRate"] == null ? null : json["AverageFrameRate"].toDouble(),
        realFrameRate: json["RealFrameRate"] == null ? null : json["RealFrameRate"].toDouble(),
        profile: json["Profile"] == null ? null : json["Profile"],
        type: typeValues.map[json["Type"]],
        aspectRatio: json["AspectRatio"] == null ? null : json["AspectRatio"],
        index: json["Index"],
        isExternal: json["IsExternal"],
        isTextSubtitleStream: json["IsTextSubtitleStream"],
        supportsExternalStream: json["SupportsExternalStream"],
        protocol: protocolValues.map[json["Protocol"]],
        pixelFormat: json["PixelFormat"] == null ? null : json["PixelFormat"],
        level: json["Level"] == null ? null : json["Level"],
        isAnamorphic: json["IsAnamorphic"] == null ? null : json["IsAnamorphic"],
        language: json["Language"] == null ? null : json["Language"],
        displayLanguage: json["DisplayLanguage"] == null ? null : json["DisplayLanguage"],
        channels: json["Channels"] == null ? null : json["Channels"],
        sampleRate: json["SampleRate"] == null ? null : json["SampleRate"],
        title: json["Title"] == null ? null : json["Title"],
        path: json["Path"] == null ? null : json["Path"],
      );

  Map<String, dynamic> toJson() => {
        "Codec": codec,
        "ColorTransfer": colorTransfer == null ? null : colorTransfer,
        "ColorPrimaries": colorPrimaries == null ? null : colorPrimaries,
        "ColorSpace": colorSpace == null ? null : colorSpace,
        "TimeBase": timeBase == null ? null : timeBase,
        "CodecTimeBase": codecTimeBase == null ? null : codecTimeBase,
        "VideoRange": videoRange == null ? null : videoRange,
        "DisplayTitle": displayTitle,
        "NalLengthSize": nalLengthSize == null ? null : nalLengthSize,
        "IsInterlaced": isInterlaced,
        "IsAVC": isAvc == null ? null : isAvc,
        "BitRate": bitRate == null ? null : bitRate,
        "BitDepth": bitDepth == null ? null : bitDepth,
        "RefFrames": refFrames == null ? null : refFrames,
        "IsDefault": isDefault,
        "IsForced": isForced,
        "Height": height == null ? null : height,
        "Width": width == null ? null : width,
        "AverageFrameRate": averageFrameRate == null ? null : averageFrameRate,
        "RealFrameRate": realFrameRate == null ? null : realFrameRate,
        "Profile": profile == null ? null : profile,
        "Type": typeValues.reverse[type],
        "AspectRatio": aspectRatio == null ? null : aspectRatio,
        "Index": index,
        "IsExternal": isExternal,
        "IsTextSubtitleStream": isTextSubtitleStream,
        "SupportsExternalStream": supportsExternalStream,
        "Protocol": protocolValues.reverse[protocol],
        "PixelFormat": pixelFormat == null ? null : pixelFormat,
        "Level": level == null ? null : level,
        "IsAnamorphic": isAnamorphic == null ? null : isAnamorphic,
        "Language": language == null ? null : language,
        "DisplayLanguage": displayLanguage == null ? null : displayLanguage,
        "Channels": channels == null ? null : channels,
        "SampleRate": sampleRate == null ? null : sampleRate,
        "Title": title == null ? null : title,
        "Path": path == null ? null : path,
      };
}

enum Protocol { FILE }

final protocolValues = EnumValues({"File": Protocol.FILE});

enum Type { VIDEO, AUDIO, SUBTITLE }

final typeValues = EnumValues({"Audio": Type.AUDIO, "Subtitle": Type.SUBTITLE, "Video": Type.VIDEO});

class RequiredHttpHeaders {
  RequiredHttpHeaders();

  factory RequiredHttpHeaders.fromRawJson(String str) => RequiredHttpHeaders.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory RequiredHttpHeaders.fromJson(Map<String, dynamic> json) => RequiredHttpHeaders();

  Map<String, dynamic> toJson() => {};
}

class Person {
  Person({
    this.name,
    this.id,
    this.role,
    this.type,
    this.primaryImageTag,
  });

  String name;
  String id;
  String role;
  PersonType type;
  String primaryImageTag;

  factory Person.fromRawJson(String str) => Person.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Person.fromJson(Map<String, dynamic> json) => Person(
        name: json["Name"],
        id: json["Id"],
        role: json["Role"],
        type: personTypeValues.map[json["Type"]],
        primaryImageTag: json["PrimaryImageTag"] == null ? null : json["PrimaryImageTag"],
      );

  Map<String, dynamic> toJson() => {
        "Name": name,
        "Id": id,
        "Role": role,
        "Type": personTypeValues.reverse[type],
        "PrimaryImageTag": primaryImageTag == null ? null : primaryImageTag,
      };
}

enum PersonType { ACTOR, DIRECTOR }

final personTypeValues = EnumValues({"Actor": PersonType.ACTOR, "Director": PersonType.DIRECTOR});

class ProviderIds {
  ProviderIds({
    this.tmdb,
    this.imdb,
  });

  String tmdb;
  String imdb;

  factory ProviderIds.fromRawJson(String str) => ProviderIds.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory ProviderIds.fromJson(Map<String, dynamic> json) => ProviderIds(
        tmdb: json["Tmdb"],
        imdb: json["Imdb"],
      );

  Map<String, dynamic> toJson() => {
        "Tmdb": tmdb,
        "Imdb": imdb,
      };
}

class UserData {
  UserData({
    this.playedPercentage,
    this.playbackPositionTicks,
    this.playCount,
    this.isFavorite,
    this.lastPlayedDate,
    this.played,
  });

  double playedPercentage;
  int playbackPositionTicks;
  int playCount;
  bool isFavorite;
  DateTime lastPlayedDate;
  bool played;

  factory UserData.fromRawJson(String str) => UserData.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory UserData.fromJson(Map<String, dynamic> json) => UserData(
        playedPercentage: json["PlayedPercentage"] != null ? json["PlayedPercentage"].toDouble() : 0,
        playbackPositionTicks: json["PlaybackPositionTicks"],
        playCount: json["PlayCount"],
        isFavorite: json["IsFavorite"],
        lastPlayedDate: json["LastPlayedDate"] != null ? DateTime.parse(json["LastPlayedDate"]) : null,
        played: json["Played"],
      );

  Map<String, dynamic> toJson() => {
        "PlayedPercentage": playedPercentage,
        "PlaybackPositionTicks": playbackPositionTicks,
        "PlayCount": playCount,
        "IsFavorite": isFavorite,
        "LastPlayedDate": lastPlayedDate.toIso8601String(),
        "Played": played,
      };
}

class EnumValues<T> {
  Map<String, T> map;
  Map<T, String> reverseMap;

  EnumValues(this.map);

  Map<T, String> get reverse {
    if (reverseMap == null) {
      reverseMap = map.map((k, v) => new MapEntry(v, k));
    }
    return reverseMap;
  }
}
